<!DOCTYPE html>



  


<html class="theme-next pisces use-motion" lang="zh-Hans">
<head><meta name="generator" content="Hexo 3.9.0">
  <meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<meta name="theme-color" content="#222">









<meta http-equiv="Cache-Control" content="no-transform">
<meta http-equiv="Cache-Control" content="no-siteapp">
















  
  
  <link href="/lib/fancybox/source/jquery.fancybox.css?v=2.1.5" rel="stylesheet" type="text/css">







<link href="/lib/font-awesome/css/font-awesome.min.css?v=4.6.2" rel="stylesheet" type="text/css">

<link href="/css/main.css?v=5.1.4" rel="stylesheet" type="text/css">


  <link rel="apple-touch-icon" sizes="180x180" href="/images/apple-touch-icon-next.png?v=5.1.4">


  <link rel="icon" type="image/png" sizes="32x32" href="/images/favicon-32x32-next.png?v=5.1.4">


  <link rel="icon" type="image/png" sizes="16x16" href="/images/favicon-16x16-next.png?v=5.1.4">


  <link rel="mask-icon" href="/images/logo.svg?v=5.1.4" color="#222">





  <meta name="keywords" content="Hexo, NexT">










<meta name="description" content="google&amp;#x767B;&amp;#x5F55;&amp;#x63A5;&amp;#x5165;&amp;#x8BF4;&amp;#x660E;&amp;#x6CE8;&amp;#x610F;&amp;#xFF1A;&amp;#x63A5;&amp;#x5165;&amp;#x767B;&amp;#x5F55;&amp;#x548C;&amp;#x652F;&amp;#x4ED8;&amp;#x540E;&amp;#x5982;&amp;#x679C;&amp;#x6709;&amp;#x5173;&amp;#x7C7B;&amp;#x627E;&amp;#x4E0D;&amp;#">
<meta property="og:type" content="article">
<meta property="og:title" content="登录说明">
<meta property="og:url" content="http://yoursite.com/2019/10/18/Android登录接入说明/index.html">
<meta property="og:site_name" content="Silence潇湘夜雨">
<meta property="og:description" content="google&amp;#x767B;&amp;#x5F55;&amp;#x63A5;&amp;#x5165;&amp;#x8BF4;&amp;#x660E;&amp;#x6CE8;&amp;#x610F;&amp;#xFF1A;&amp;#x63A5;&amp;#x5165;&amp;#x767B;&amp;#x5F55;&amp;#x548C;&amp;#x652F;&amp;#x4ED8;&amp;#x540E;&amp;#x5982;&amp;#x679C;&amp;#x6709;&amp;#x5173;&amp;#x7C7B;&amp;#x627E;&amp;#x4E0D;&amp;#">
<meta property="og:locale" content="zh-Hans">
<meta property="og:updated_time" content="2019-10-30T04:28:19.867Z">
<meta name="twitter:card" content="summary">
<meta name="twitter:title" content="登录说明">
<meta name="twitter:description" content="google&amp;#x767B;&amp;#x5F55;&amp;#x63A5;&amp;#x5165;&amp;#x8BF4;&amp;#x660E;&amp;#x6CE8;&amp;#x610F;&amp;#xFF1A;&amp;#x63A5;&amp;#x5165;&amp;#x767B;&amp;#x5F55;&amp;#x548C;&amp;#x652F;&amp;#x4ED8;&amp;#x540E;&amp;#x5982;&amp;#x679C;&amp;#x6709;&amp;#x5173;&amp;#x7C7B;&amp;#x627E;&amp;#x4E0D;&amp;#">



<script type="text/javascript" id="hexo.configurations">
  var NexT = window.NexT || {};
  var CONFIG = {
    root: '/',
    scheme: 'Pisces',
    version: '5.1.4',
    sidebar: {"position":"left","display":"post","offset":12,"b2t":true,"scrollpercent":true,"onmobile":false},
    fancybox: true,
    tabs: true,
    motion: {"enable":true,"async":false,"transition":{"post_block":"fadeIn","post_header":"slideDownIn","post_body":"slideDownIn","coll_header":"slideLeftIn","sidebar":"slideUpIn"}},
    duoshuo: {
      userId: '0',
      author: '博主'
    },
    algolia: {
      applicationID: '',
      apiKey: '',
      indexName: '',
      hits: {"per_page":10},
      labels: {"input_placeholder":"Search for Posts","hits_empty":"We didn't find any results for the search: ${query}","hits_stats":"${hits} results found in ${time} ms"}
    }
  };
</script>



  <link rel="canonical" href="http://yoursite.com/2019/10/18/Android登录接入说明/">





  <title>登录说明 | Silence潇湘夜雨</title>
  








</head>

<body itemscope itemtype="http://schema.org/WebPage" lang="zh-Hans">

  
  
    
  

  <div class="container sidebar-position-left page-post-detail">
    <div class="headband"></div>

    <header id="header" class="header" itemscope itemtype="http://schema.org/WPHeader">
      <div class="header-inner"><div class="site-brand-wrapper">
  <div class="site-meta ">
    

    <div class="custom-logo-site-title">
      <a href="/" class="brand" rel="start">
        <span class="logo-line-before"><i></i></span>
        <span class="site-title">Silence潇湘夜雨</span>
        <span class="logo-line-after"><i></i></span>
      </a>
    </div>
      
        <p class="site-subtitle">Android开发一枚</p>
      
  </div>

  <div class="site-nav-toggle">
    <button>
      <span class="btn-bar"></span>
      <span class="btn-bar"></span>
      <span class="btn-bar"></span>
    </button>
  </div>
</div>

<nav class="site-nav">
  

  
    <ul id="menu" class="menu">
      
        
        <li class="menu-item menu-item-home">
          <a href="/" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-home //首页"></i> <br>
            
            首页
          </a>
        </li>
      
        
        <li class="menu-item menu-item-about">
          <a href="/about/" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-user //关于"></i> <br>
            
            关于
          </a>
        </li>
      
        
        <li class="menu-item menu-item-tags">
          <a href="/tags/" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-tags  //标签"></i> <br>
            
            标签
          </a>
        </li>
      
        
        <li class="menu-item menu-item-categories">
          <a href="/categories/" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-th //分类"></i> <br>
            
            分类
          </a>
        </li>
      
        
        <li class="menu-item menu-item-archives">
          <a href="/archives/" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-archive //归档"></i> <br>
            
            归档
          </a>
        </li>
      
        
        <li class="menu-item menu-item-schedule">
          <a href="/schedule/" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-calendar //日程表"></i> <br>
            
            日程表
          </a>
        </li>
      
        
        <li class="menu-item menu-item-sitemap">
          <a href="/sitemap.xml" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-sitemap //站点地图"></i> <br>
            
            站点地图
          </a>
        </li>
      

      
    </ul>
  

  
</nav>



 </div>
    </header>

    <main id="main" class="main">
      <div class="main-inner">
        <div class="content-wrap">
          <div id="content" class="content">
            

  <div id="posts" class="posts-expand">
    

  

  
  
  

  <article class="post post-type-normal" itemscope itemtype="http://schema.org/Article">
  
  
  
  <div class="post-block">
    <link itemprop="mainEntityOfPage" href="http://yoursite.com/2019/10/18/Android登录接入说明/">

    <span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">
      <meta itemprop="name" content="Silence潇湘夜雨">
      <meta itemprop="description" content>
      <meta itemprop="image" content="/images/avatar.gif">
    </span>

    <span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
      <meta itemprop="name" content="Silence潇湘夜雨">
    </span>

    
      <header class="post-header">

        
        
          <h1 class="post-title" itemprop="name headline">登录说明</h1>
        

        <div class="post-meta">
          <span class="post-time">
            
              <span class="post-meta-item-icon">
                <i class="fa fa-calendar-o"></i>
              </span>
              
                <span class="post-meta-item-text">发表于</span>
              
              <time title="创建于" itemprop="dateCreated datePublished" datetime="2019-10-18T18:06:37+08:00">
                2019-10-18
              </time>
            

            

            
          </span>

          
            <span class="post-category">
            
              <span class="post-meta-divider">|</span>
            
              <span class="post-meta-item-icon">
                <i class="fa fa-folder-o"></i>
              </span>
              
                <span class="post-meta-item-text">分类于</span>
              
              
                <span itemprop="about" itemscope itemtype="http://schema.org/Thing">
                  <a href="/categories/登录/" itemprop="url" rel="index">
                    <span itemprop="name">登录</span>
                  </a>
                </span>

                
                
              
            </span>
          

          
            
          

          
          

          

          
            <div class="post-wordcount">
              
                
                <span class="post-meta-item-icon">
                  <i class="fa fa-file-word-o"></i>
                </span>
                
                  <span class="post-meta-item-text">字数统计&#58;</span>
                
                <span title="字数统计">
                  1.7k
                </span>
              

              
                <span class="post-meta-divider">|</span>
              

              
                <span class="post-meta-item-icon">
                  <i class="fa fa-clock-o"></i>
                </span>
                
                  <span class="post-meta-item-text">阅读时长 &asymp;</span>
                
                <span title="阅读时长">
                  10
                </span>
              
            </div>
          

          

        </div>
      </header>
    

    
    
    
    <div class="post-body" itemprop="articleBody">

      
      

      
        <h3 id="google&#x767B;&#x5F55;&#x63A5;&#x5165;&#x8BF4;&#x660E;"><a href="#google&#x767B;&#x5F55;&#x63A5;&#x5165;&#x8BF4;&#x660E;" class="headerlink" title="google&#x767B;&#x5F55;&#x63A5;&#x5165;&#x8BF4;&#x660E;"></a>google&#x767B;&#x5F55;&#x63A5;&#x5165;&#x8BF4;&#x660E;</h3><p><strong>&#x6CE8;&#x610F;&#xFF1A;&#x63A5;&#x5165;&#x767B;&#x5F55;&#x548C;&#x652F;&#x4ED8;&#x540E;&#x5982;&#x679C;&#x6709;&#x5173;&#x7C7B;&#x627E;&#x4E0D;&#x5230;&#xFF0C;&#x9700;&#x8981;&#x63A5;&#x5165;&#x6838;&#x5FC3;&#x5E93;&#x548C;&#x7F51;&#x7EDC;&#x5E93;</strong></p>
<figure class="highlight java"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">implementation <span class="string">&apos;com.github.muyishuangfeng:YKCore:1.0.0&apos;</span></span><br><span class="line">implementation <span class="string">&apos;com.github.muyishuangfeng:YKNet:1.0.1&apos;</span></span><br></pre></td></tr></table></figure>

<ul>
<li><p>1&#x3001;&#x5728;project &#x4E0B;&#x7684;build &#x5BFC;&#x5165;&#x4ED3;&#x5E93;&#x5730;&#x5740;</p>
<pre><code>maven {
 url &quot;https://jitpack.io&quot;}</code></pre></li>
</ul>
<ul>
<li><p>2&#x3001;&#x5728;moudle&#x4E0B;&#x9762;&#x7684;build&#x6587;&#x4EF6;&#x4E0B;&#x6DFB;&#x52A0;&#x7F51;&#x7EDC;&#x5E93;&#x4F9D;&#x8D56;<br> &#x200B;     </p>
<pre><code>implementation &apos;com.github.muyishuangfeng:YKGoogle:1.0.0&apos;</code></pre></li>
</ul>
<p>  &#x200B;    </p>
<p><strong>1&#x3001;&#x521D;&#x59CB;&#x5316;&#x53C2;&#x6570;&#x8BF4;&#x660E;</strong> </p>
<table>
<thead>
<tr>
<th align="center">&#x53C2;&#x6570;</th>
<th align="center">&#x7C7B;&#x578B;</th>
<th align="center">&#x662F;&#x5426;&#x5FC5;&#x987B;</th>
<th align="left">&#x8BF4;&#x660E;</th>
</tr>
</thead>
<tbody><tr>
<td align="center">debug</td>
<td align="center">boolean</td>
<td align="center">&#x5426;</td>
<td align="left">&#x662F;&#x5426;&#x5F00;&#x542F;debug&#x6A21;&#x5F0F;</td>
</tr>
<tr>
<td align="center">clientID</td>
<td align="center">String</td>
<td align="center">&#x662F;</td>
<td align="left">Google&#x5E73;&#x53F0;&#x914D;&#x7F6E;&#x7684;&#x5BA2;&#x6237;&#x7AEF;ID</td>
</tr>
<tr>
<td align="center">requestCode</td>
<td align="center">int</td>
<td align="center">&#x662F;</td>
<td align="left">&#x652F;&#x4ED8;&#x8BF7;&#x6C42;&#x7801;</td>
</tr>
<tr>
<td align="center">Target</td>
<td align="center">int</td>
<td align="center">&#x662F;</td>
<td align="left">&#x662F;&#x5426;&#x5F00;&#x542F;Google&#x767B;&#x5F55;</td>
</tr>
<tr>
<td align="center">LoginObject</td>
<td align="center">bean</td>
<td align="center">&#x662F;</td>
<td align="left">&#x767B;&#x5F55;&#x914D;&#x7F6E;&#x7684;&#x53C2;&#x6570;</td>
</tr>
<tr>
<td align="center">OnLoginStateListener</td>
<td align="center">Interface</td>
<td align="center">&#x662F;</td>
<td align="left">&#x767B;&#x5F55;&#x56DE;&#x8C03;&#x63A5;&#x53E3;</td>
</tr>
</tbody></table>
<p><strong>2&#x3001;&#x652F;&#x4ED8;&#x8C03;&#x7528;&#x65B9;&#x5F0F;</strong></p>
<ul>
<li><p>1&#x3001;&#x521D;&#x59CB;&#x5316;&#xFF08;&#x521A;&#x8FDB;&#x5165;&#x5E94;&#x7528;&#x6216;&#x8005;&#x652F;&#x4ED8;&#x9875;&#x9762;&#x7684;&#x65F6;&#x5019;&#x914D;&#x7F6E;&#xFF09;</p>
<pre><code>private void init() {
  YKGameOptions options = new YKGameOptions.Builder(this)
          .debug(true)
          .google(clientID)
          .requestCode(REQUEST_CODE)
          .build();
  YKGameSdk.init(options);
}</code></pre><ul>
<li>2&#x3001;&#x63A5;&#x53E3;&#x56DE;&#x8C03;&#xFF08;&#x53EF;&#x4EE5;&#x5199;&#x6210;&#x533F;&#x540D;&#x5185;&#x90E8;&#x7C7B;&#x7684;&#x65B9;&#x5F0F;&#x4E5F;&#x53EF;&#x4EE5;&#x5199;&#x6210;&#x5168;&#x5C40;&#x65B9;&#x5F0F;&#xFF09;</li>
</ul>
</li>
</ul>
<figure class="highlight java"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br></pre></td><td class="code"><pre><span class="line">mOnLoginListener = <span class="keyword">new</span> OnLoginStateListener() {</span><br><span class="line">      <span class="meta">@Override</span></span><br><span class="line">      <span class="function"><span class="keyword">public</span> <span class="keyword">void</span> <span class="title">onState</span><span class="params">(Activity activity, LoginResult result)</span> </span>{</span><br><span class="line">           <span class="keyword">case</span> LoginResult.STATE_RESULT:</span><br><span class="line">                      BaseEntry entry = result.getBaseEntry();</span><br><span class="line">                      <span class="keyword">if</span>(entry!=nul){</span><br><span class="line">                      <span class="keyword">switch</span> (entry.getCode()) {</span><br><span class="line">                          <span class="keyword">case</span> YKGameValues.GOOGLE_LOGIN_SUCCESS: {</span><br><span class="line">                              Log.e(TAG, <span class="string">&quot;success=====&quot;</span> + entry.getResult());</span><br><span class="line">                              <span class="keyword">break</span>;</span><br><span class="line">                          }</span><br><span class="line">                          <span class="keyword">case</span> YKGameValues.GOOGLE_LOGIN_FAILED: {</span><br><span class="line">                              Log.e(TAG, <span class="string">&quot;failed=====&quot;</span> + entry.getResult());</span><br><span class="line">                              <span class="keyword">break</span>;</span><br><span class="line">                          }</span><br><span class="line">                      }</span><br><span class="line">                     </span><br><span class="line">          </span><br><span class="line">      }</span><br><span class="line"></span><br><span class="line">  };</span><br></pre></td></tr></table></figure>

<ul>
<li>3&#x3001;&#x767B;&#x5F55;&#x5F00;&#x59CB;</li>
</ul>
<figure class="highlight java"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br></pre></td><td class="code"><pre><span class="line">LoginObject object = <span class="keyword">new</span> LoginObject();</span><br><span class="line">object.setmGoogleClient(clientID);<span class="comment">//&#x5BA2;&#x6237;&#x7AEF;ID</span></span><br><span class="line">object.setSelfRequestCode(REQUEST_CODE);<span class="comment">//&#x8BF7;&#x6C42;&#x7801;</span></span><br><span class="line">object.setLoginOut(<span class="keyword">false</span>);<span class="comment">//&#x662F;&#x5426;&#x6E05;&#x7A7A;&#x767B;&#x5F55;&#x4FE1;&#x606F;&#x91CD;&#x65B0;&#x767B;&#x5F55;</span></span><br><span class="line">LoginManager.login(GoogleActivity.<span class="keyword">this</span>, Target.LOGIN_GOOGLE,      object, mOnLoginListener);</span><br></pre></td></tr></table></figure>

<p>&#x200B;      </p>
<ul>
<li>4&#x3001;&#x9000;&#x51FA;&#x767B;&#x5F55;</li>
</ul>
<figure class="highlight java"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br></pre></td><td class="code"><pre><span class="line">LoginObject object = <span class="keyword">new</span> LoginObject();</span><br><span class="line">object.setmGoogleClient(clientID);<span class="comment">//&#x5BA2;&#x6237;&#x7AEF;ID</span></span><br><span class="line">object.setSelfRequestCode(REQUEST_CODE);<span class="comment">//&#x8BF7;&#x6C42;&#x7801;</span></span><br><span class="line">object.setLoginOut(<span class="keyword">true</span>);<span class="comment">//&#x662F;&#x5426;&#x9000;&#x51FA;&#x767B;&#x5F55;</span></span><br><span class="line">LoginManager.login(GoogleActivity.<span class="keyword">this</span>, Target.LOGIN_GOOGLE,      object, mOnLoginListener);</span><br></pre></td></tr></table></figure>

<p>&#x200B;      </p>
<ul>
<li>5&#x3001;&#x7ED3;&#x679C;&#x7801;&#xFF08;&#x5177;&#x4F53;&#x4EE5;&#x63A5;&#x53E3;&#x56DE;&#x8C03;&#x7ED3;&#x679C;&#x4E3A;&#x51C6;&#xFF09;</li>
</ul>
<figure class="highlight java"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment">//&#x5F00;&#x59CB;</span></span><br><span class="line">STATE_START</span><br><span class="line"><span class="comment">//&#x6210;&#x529F;</span></span><br><span class="line">STATE_SUCCESS </span><br><span class="line"><span class="comment">//&#x5931;&#x8D25;</span></span><br><span class="line">STATE_FAIL</span><br><span class="line"><span class="comment">//&#x53D6;&#x6D88;</span></span><br><span class="line">STATE_CANCEL</span><br><span class="line"><span class="comment">//&#x5B8C;&#x6210;</span></span><br><span class="line">STATE_COMPLETE </span><br><span class="line"><span class="comment">//&#x6709;&#x6548;</span></span><br><span class="line">STATE_ACTIVE </span><br><span class="line"> <span class="comment">//&#x9000;&#x51FA;&#x767B;&#x5F55;</span></span><br><span class="line">STATE_LOGIN_OUT</span><br><span class="line"><span class="comment">//&#x767B;&#x5F55;&#x6210;&#x529F;</span></span><br><span class="line">GOOGLE_LOGIN_SUCCESS</span><br><span class="line"> <span class="comment">//&#x767B;&#x5F55;&#x5931;&#x8D25;</span></span><br><span class="line">GOOGLE_LOGIN_FAILED</span><br></pre></td></tr></table></figure>

<p><strong>&#x6CE8;&#x610F;&#xFF1A;LoginResult</strong> &#x9644;&#x5E26;&#x6709;&#x767B;&#x5F55;&#x7ED3;&#x679C; <strong>result.getResultModel().toString()</strong>&#x4E3A;&#x5177;&#x4F53;&#x4FE1;&#x606F;</p>
<h4 id="Facebook&#x767B;&#x5F55;&#x8BF4;&#x660E;"><a href="#Facebook&#x767B;&#x5F55;&#x8BF4;&#x660E;" class="headerlink" title="Facebook&#x767B;&#x5F55;&#x8BF4;&#x660E;"></a>Facebook&#x767B;&#x5F55;&#x8BF4;&#x660E;</h4><p><strong>&#x6CE8;&#x610F;:&#x5982;&#x679C;&#x5728;project&#x4E0B;&#x7684;build&#x6587;&#x4EF6;&#x6587;&#x4EF6;&#x4E0B;&#x6DFB;&#x52A0;&#x4E86;&#x7F51;&#x7EDC;&#x5E93;&#xFF0C;&#x8BF7;&#x5FFD;&#x7565;1&#x3001;3&#x914D;&#x7F6E;&#xFF0C;&#x76F4;&#x63A5;&#x770B;2</strong></p>
<ul>
<li>1&#x3001;&#x5728;project &#x4E0B;&#x7684;build &#x5BFC;&#x5165;&#x4ED3;&#x5E93;&#x5730;&#x5740;</li>
</ul>
<figure class="highlight java"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br></pre></td><td class="code"><pre><span class="line">maven {</span><br><span class="line"></span><br><span class="line">  url <span class="string">&quot;https://jitpack.io&quot;</span></span><br><span class="line"></span><br><span class="line">}</span><br></pre></td></tr></table></figure>

<ul>
<li><p>2&#x3001;&#x5728;moudle&#x4E0B;&#x9762;&#x7684;build&#x6587;&#x4EF6;&#x4E0B;&#x6DFB;&#x52A0;&#x7F51;&#x7EDC;&#x5E93;&#x4F9D;&#x8D56;<br>&#x200B;     </p>
<figure class="highlight java"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">implementation <span class="string">&apos;com.github.muyishuangfeng:YKFacebook:1.0.0&apos;</span></span><br></pre></td></tr></table></figure>
</li>
<li><p>3&#x3001;&#x5728;moudle&#x7684;build&#x6587;&#x4EF6;&#x5939;&#x4E0B;&#x7684;android &#x2014;&gt;defaultConfig &#x548C; android&#x2014;&gt;buildTypes &#x4E0B;&#x7684;release &#x548C; debug&#x4E0B;&#x9762;&#x914D;&#x7F6E; Facebook ID&#x548C;scheme</p>
<pre><code>defaultConfig {
...
manifestPlaceholders = [Facebook_app_id         : &quot;xxx&quot;,//FacebookID&#xFF08;Facebook&#x7533;&#x8BF7;&#x7684;ApplicationId&#xFF09;
                        fb_login_protocol_scheme: &quot;xxx&quot;]//FacebookScheme</code></pre></li>
</ul>
<pre><code>&#x200B;    
     }

     buildTypes {
      release {
     ...
     signingConfig signingConfigs.config
      manifestPlaceholders = [Facebook_app_id         :    &quot;xx&quot;,//FacebookID&#xFF08;Facebook&#x7533;&#x8BF7;&#x7684;ApplicationId&#xFF09;
      fb_login_protocol_scheme: &quot;xxx&quot;]//FacebookScheme

    }
    debug {
        signingConfig signingConfigs.config
        manifestPlaceholders = [Facebook_app_id         : &quot;xx&quot;,//FacebookID&#xFF08;Facebook&#x7533;&#x8BF7;&#x7684;ApplicationId&#xFF09;
                                fb_login_protocol_scheme: &quot;xxx&quot;]//FacebookScheme
    }
  }</code></pre><p><strong>1&#x3001;&#x521D;&#x59CB;&#x5316;&#x53C2;&#x6570;&#x8BF4;&#x660E;</strong> </p>
<table>
<thead>
<tr>
<th align="center">&#x53C2;&#x6570;</th>
<th align="center">&#x7C7B;&#x578B;</th>
<th align="center">&#x662F;&#x5426;&#x5FC5;&#x987B;</th>
<th align="left">&#x8BF4;&#x660E;</th>
</tr>
</thead>
<tbody><tr>
<td align="center">debug</td>
<td align="center">boolean</td>
<td align="center">&#x5426;</td>
<td align="left">&#x662F;&#x5426;&#x5F00;&#x542F;debug&#x6A21;&#x5F0F;</td>
</tr>
<tr>
<td align="center">facebookEnable</td>
<td align="center">boolean</td>
<td align="center">&#x662F;</td>
<td align="left">&#x662F;&#x5426;&#x542F;&#x7528;Facebook</td>
</tr>
<tr>
<td align="center">mFacebookId</td>
<td align="center">String</td>
<td align="center">&#x662F;</td>
<td align="left">Facebook&#x5B98;&#x7F51;&#x7533;&#x8BF7;&#x7684;appID</td>
</tr>
<tr>
<td align="center">Target</td>
<td align="center">int</td>
<td align="center">&#x662F;</td>
<td align="left">&#x662F;&#x5426;&#x5F00;&#x542F;Google&#x767B;&#x5F55;</td>
</tr>
<tr>
<td align="center">LoginObject</td>
<td align="center">bean</td>
<td align="center">&#x662F;</td>
<td align="left">&#x767B;&#x5F55;&#x914D;&#x7F6E;&#x7684;&#x53C2;&#x6570;</td>
</tr>
<tr>
<td align="center">OnLoginStateListener</td>
<td align="center">Interface</td>
<td align="center">&#x662F;</td>
<td align="left">&#x767B;&#x5F55;&#x56DE;&#x8C03;&#x63A5;&#x53E3;</td>
</tr>
</tbody></table>
<p><strong>2&#x3001;&#x767B;&#x5F55;&#x8C03;&#x7528;&#x65B9;&#x5F0F;</strong></p>
<ul>
<li><p>1&#x3001;&#x521D;&#x59CB;&#x5316;&#xFF08;&#x521A;&#x8FDB;&#x5165;&#x5E94;&#x7528;&#x6216;&#x8005;&#x652F;&#x4ED8;&#x9875;&#x9762;&#x7684;&#x65F6;&#x5019;&#x914D;&#x7F6E;&#xFF09;</p>
<pre><code>private void init() {
  YKGameOptions options = new YKGameOptions.Builder(this)
          .debug(true)
          .facebook(mFacebookId)
          .facebookEnable()
          .build();
  YKGameSdk.init(options);
}</code></pre><ul>
<li>2&#x3001;&#x63A5;&#x53E3;&#x56DE;&#x8C03;&#xFF08;&#x53EF;&#x4EE5;&#x5199;&#x6210;&#x533F;&#x540D;&#x5185;&#x90E8;&#x7C7B;&#x7684;&#x65B9;&#x5F0F;&#x4E5F;&#x53EF;&#x4EE5;&#x5199;&#x6210;&#x5168;&#x5C40;&#x65B9;&#x5F0F;&#xFF09;</li>
</ul>
</li>
</ul>
<figure class="highlight java"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br></pre></td><td class="code"><pre><span class="line">mOnLoginListener = <span class="keyword">new</span> OnLoginStateListener() {</span><br><span class="line">    <span class="meta">@Override</span></span><br><span class="line">    <span class="function"><span class="keyword">public</span> <span class="keyword">void</span> <span class="title">onState</span><span class="params">(Activity activity, LoginResult result)</span> </span>{</span><br><span class="line">       <span class="keyword">if</span> (result.state == LoginResult.STATE_RESULT) {</span><br><span class="line">                BaseEntry entry = result.getBaseEntry();</span><br><span class="line">                <span class="keyword">switch</span> (entry.getCode()) {</span><br><span class="line">                    <span class="keyword">case</span> YKGameValues.FACEBOOK_LOGIN_SUCCESS: {</span><br><span class="line">                        Log.e(TAG, <span class="string">&quot;success===&quot;</span> + entry.getResult());</span><br><span class="line">                        <span class="keyword">break</span>;</span><br><span class="line">                    }</span><br><span class="line">                    <span class="keyword">case</span> YKGameValues.FACEBOOK_LOGIN_FAILED: {</span><br><span class="line">                        Log.e(TAG, <span class="string">&quot;failed===&quot;</span> + entry.getResult());</span><br><span class="line">                        <span class="keyword">break</span>;</span><br><span class="line">                    }</span><br><span class="line">                    <span class="keyword">case</span> YKGameValues.FACEBOOK_LOGIN_CANCEL: {</span><br><span class="line">                        Log.e(TAG, <span class="string">&quot;cancel===&quot;</span> + entry.getResult());</span><br><span class="line">                        <span class="keyword">break</span>;</span><br><span class="line">                    }</span><br><span class="line">                    <span class="keyword">case</span> YKGameValues.FACEBOOK_LOGIN_OUT: {</span><br><span class="line">                        Log.e(TAG, <span class="string">&quot;loginOut===&quot;</span> + entry.getResult());</span><br><span class="line">                        <span class="keyword">break</span>;</span><br><span class="line">                    }</span><br><span class="line">                }</span><br><span class="line">            </span><br><span class="line">    }</span><br><span class="line"></span><br><span class="line">};</span><br></pre></td></tr></table></figure>

<ul>
<li>3&#x3001;&#x767B;&#x5F55;&#x5F00;&#x59CB;</li>
</ul>
<figure class="highlight java"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><span class="line">LoginObject object = <span class="keyword">new</span> LoginObject();</span><br><span class="line">object.setFacebookAppID(<span class="string">&quot;xxx&quot;</span>);<span class="comment">//Facebook&#x7684;ApplicationID</span></span><br><span class="line">object.setLoginOut(<span class="keyword">false</span>);<span class="comment">//&#x662F;&#x5426;&#x6E05;&#x7A7A;&#x767B;&#x5F55;&#x4FE1;&#x606F;&#x91CD;&#x65B0;&#x767B;&#x5F55;</span></span><br><span class="line">LoginManager.login(GoogleActivity.<span class="keyword">this</span>, Target.LOGIN_FACEBOOK, object, mOnLoginListener);</span><br></pre></td></tr></table></figure>

<ul>
<li>4&#x3001;&#x9000;&#x51FA;&#x767B;&#x5F55;</li>
</ul>
<figure class="highlight java"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><span class="line">LoginObject object = <span class="keyword">new</span> LoginObject();</span><br><span class="line">object.setFacebookAppID(<span class="string">&quot;xxx&quot;</span>);<span class="comment">//Facebook&#x7684;ApplicationID</span></span><br><span class="line">object.setLoginOut(<span class="keyword">false</span>);<span class="comment">//&#x662F;&#x5426;&#x6E05;&#x7A7A;&#x767B;&#x5F55;&#x4FE1;&#x606F;&#x91CD;&#x65B0;&#x767B;&#x5F55;</span></span><br><span class="line">LoginManager.login(GoogleActivity.<span class="keyword">this</span>, Target.LOGIN_FACEBOOK, object, mOnLoginListener);</span><br></pre></td></tr></table></figure>

<ul>
<li>5&#x3001;&#x7ED3;&#x679C;&#x7801;&#xFF08;&#x5177;&#x4F53;&#x4EE5;&#x63A5;&#x53E3;&#x56DE;&#x8C03;&#x7ED3;&#x679C;&#x4E3A;&#x51C6;&#xFF09;</li>
</ul>
<ul>
<li><figure class="highlight java"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment">//&#x767B;&#x5F55;&#x6210;&#x529F;</span></span><br><span class="line">FACEBOOK_LOGIN_SUCCESS</span><br><span class="line"><span class="comment">//&#x767B;&#x5F55;&#x5931;&#x8D25;</span></span><br><span class="line">FACEBOOK_LOGIN_FAILED</span><br><span class="line"><span class="comment">//&#x53D6;&#x6D88;&#x767B;&#x5F55;</span></span><br><span class="line">FACEBOOK_LOGIN_CANCEL</span><br><span class="line"><span class="comment">//&#x9000;&#x51FA;&#x767B;&#x5F55;</span></span><br><span class="line">FACEBOOK_LOGIN_OUT</span><br></pre></td></tr></table></figure>

</li>
</ul>
<p><strong>&#x6CE8;&#x610F;&#xFF1A;LoginResult</strong> &#x9644;&#x5E26;&#x6709;&#x767B;&#x5F55;&#x7ED3;&#x679C; <strong>result.getResultModel().toString()</strong>&#x4E3A;&#x5177;&#x4F53;&#x4FE1;&#x606F;</p>
<p> <strong>&#x6CE8;&#x610F;&#xFF1A;&#x517C;&#x5BB9;Android9.0 Http&#x8BF7;&#x6C42;&#x7684;&#x7F51;&#x7EDC;&#x8BF7;&#x6C42;&#x65B9;&#x5F0F;</strong></p>
<ul>
<li>1&#x3001;&#x5728;res&#x76EE;&#x5F55;&#x4E0B;&#x521B;&#x5EFA;xml&#x6587;&#x4EF6;&#x5939;</li>
<li>2&#x3001;&#x5728;xml&#x6587;&#x4EF6;&#x5939;&#x4E0B;&#x521B;&#x5EFA;network_security_config.xml&#x6587;&#x4EF6;&#x5939;</li>
</ul>
<pre><code>&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;
&lt;network-security-config&gt;
&lt;base-config cleartextTrafficPermitted=&quot;true&quot; /&gt;
&lt;/network-security-config&gt;</code></pre><ul>
<li>3&#x3001;&#x5728;&#x6E05;&#x5355;&#x6587;&#x4EF6;&#xFF08;AndroidManifest&#xFF09;&#x4E2D;&#x7684;Application&#x8282;&#x70B9;&#x4E0B;&#x914D;&#x7F6E;&#x5F15;&#x7528;</li>
</ul>
<pre><code>&lt;application
android:networkSecurityConfig=&quot;@xml/network_security_config&quot;
/&gt;</code></pre><h3 id="QQ-&#x767B;&#x5F55;&#x8BF4;&#x660E;"><a href="#QQ-&#x767B;&#x5F55;&#x8BF4;&#x660E;" class="headerlink" title="QQ &#x767B;&#x5F55;&#x8BF4;&#x660E;"></a>QQ &#x767B;&#x5F55;&#x8BF4;&#x660E;</h3><p><strong>&#x6CE8;&#x610F;:&#x5982;&#x679C;&#x5728;project&#x4E0B;&#x7684;build &#x6587;&#x4EF6;&#x4E0B;&#x6DFB;&#x52A0;&#x4E86; &#x8FDC;&#x7A0B;&#x4F9D;&#x8D56;&#xFF0C;&#x8BF7;&#x5FFD;&#x7565;1&#x914D;&#x7F6E;&#xFF0C;&#x76F4;&#x63A5;&#x770B;2&#x548C;3</strong></p>
<ul>
<li>1&#x3001;&#x5728;project &#x4E0B;&#x7684;build &#x5BFC;&#x5165;&#x4ED3;&#x5E93;&#x5730;&#x5740;</li>
</ul>
<pre><code>maven {

 url &quot;https://jitpack.io&quot;
 }</code></pre><ul>
<li><p>2&#x3001;&#x5728;moudle&#x4E0B;&#x9762;&#x7684;build&#x6587;&#x4EF6;&#x4E0B;&#x6DFB;&#x52A0;&#x7F51;&#x7EDC;&#x5E93;&#x4F9D;&#x8D56;<br>&#x200B;     </p>
<pre><code>implementation &apos;com.github.muyishuangfeng:YKSDKQQ-Android:1.0.0&apos;</code></pre></li>
<li><p>3&#x3001;&#x5728;moudle&#x7684;build&#x6587;&#x4EF6;&#x5939;&#x4E0B;&#x7684;android &#x2014;&gt;defaultConfig &#x548C; android&#x2014;&gt;buildTypes &#x4E0B;&#x7684;release &#x548C; debug&#x4E0B;&#x9762;&#x914D;&#x7F6E; Facebook ID&#x548C;scheme</p>
<pre><code>defaultConfig {
...
manifestPlaceholders = [...
                        QQAppID: &quot;xxx&quot;]//QQAppID</code></pre></li>
</ul>
<pre><code>&#x200B;    
     }

     buildTypes {
      release {
     ...
     signingConfig signingConfigs.config
     manifestPlaceholders = [...
                            QQAppID: &quot;xxx&quot;]//QQAppID

    }
    debug {
        signingConfig signingConfigs.config
        manifestPlaceholders = [...
                            QQAppID: &quot;xxx&quot;]//QQAppID
    }
  }</code></pre><p><strong>1&#x3001;&#x521D;&#x59CB;&#x5316;&#x53C2;&#x6570;&#x8BF4;&#x660E;</strong> </p>
<table>
<thead>
<tr>
<th align="center">&#x53C2;&#x6570;</th>
<th align="center">&#x7C7B;&#x578B;</th>
<th align="center">&#x662F;&#x5426;&#x5FC5;&#x987B;</th>
<th align="left">&#x8BF4;&#x660E;</th>
</tr>
</thead>
<tbody><tr>
<td align="center">debug</td>
<td align="center">boolean</td>
<td align="center">&#x5426;</td>
<td align="left">&#x662F;&#x5426;&#x5F00;&#x542F;debug&#x6A21;&#x5F0F;</td>
</tr>
<tr>
<td align="center">LT-AppID</td>
<td align="center">String</td>
<td align="center">&#x662F;</td>
<td align="left">&#x6BCF;&#x4E2A;&#x5E94;&#x7528;&#x5BF9;&#x5E94;&#x7684;appid</td>
</tr>
<tr>
<td align="center">LTAppKey</td>
<td align="center">String</td>
<td align="center">&#x662F;</td>
<td align="left">&#x6BCF;&#x4E2A;&#x5E94;&#x7528;&#x5BF9;&#x5E94;&#x7684;appKey</td>
</tr>
<tr>
<td align="center">baseUrl</td>
<td align="center">String</td>
<td align="center">&#x662F;</td>
<td align="left">&#x6839;&#x636E;&#x5177;&#x4F53;&#x670D;&#x52A1;&#x5668;&#x914D;&#x7F6E;</td>
</tr>
<tr>
<td align="center">mQQAppID</td>
<td align="center">String</td>
<td align="center">&#x662F;</td>
<td align="left">QQ&#x5E73;&#x53F0;&#x7533;&#x8BF7;&#x7684;AppID</td>
</tr>
<tr>
<td align="center">mAdID</td>
<td align="center">String</td>
<td align="center">&#x662F;</td>
<td align="left">&#x5E7F;&#x544A;ID&#xFF08;&#x83B7;&#x53D6;&#x65B9;&#x6CD5;&#x770B;&#x6587;&#x6863;&#xFF09;</td>
</tr>
<tr>
<td align="center">qQEnable</td>
<td align="center">boolean</td>
<td align="center">&#x662F;</td>
<td align="left">&#x662F;&#x5426;&#x5F00;&#x542F;QQ&#x767B;&#x5F55;</td>
</tr>
<tr>
<td align="center">Target</td>
<td align="center">int</td>
<td align="center">&#x662F;</td>
<td align="left">&#x662F;&#x5426;&#x5F00;&#x542F;Google&#x767B;&#x5F55;</td>
</tr>
<tr>
<td align="center">loginOut</td>
<td align="center">boolean</td>
<td align="center">&#x662F;</td>
<td align="left">&#x662F;&#x5426;&#x9000;&#x51FA;&#x767B;&#x5F55;&#xFF08;true&#xFF1A;&#x662F;&#xFF0C;false&#xFF1A;&#x5426;&#xFF09;</td>
</tr>
<tr>
<td align="center">OnLoginStateListener</td>
<td align="center">Interface</td>
<td align="center">&#x662F;</td>
<td align="left">&#x767B;&#x5F55;&#x56DE;&#x8C03;&#x63A5;&#x53E3;</td>
</tr>
</tbody></table>
<p><strong>2&#x3001;&#x767B;&#x5F55;&#x8C03;&#x7528;&#x65B9;&#x5F0F;</strong></p>
<ul>
<li><p>1&#x3001;&#x521D;&#x59CB;&#x5316;&#xFF08;&#x521A;&#x8FDB;&#x5165;&#x5E94;&#x7528;&#x6216;&#x8005;&#x652F;&#x4ED8;&#x9875;&#x9762;&#x7684;&#x65F6;&#x5019;&#x914D;&#x7F6E;&#xFF09;</p>
<pre><code>private void init() {
  YKGameOptions options = new YKGameOptions.Builder(this)
          .debug(true)
          .appID(LTAppID)
          .appKey(LTAppKey)
          .baseUrl(baseUrl)
          .setAdID(mAdID)
          .setQQEnable(true)
          .qq(mQQAppID)
          .build();
  YKGameSdk.init(options);
}</code></pre><ul>
<li>2&#x3001;&#x63A5;&#x53E3;&#x56DE;&#x8C03;&#xFF08;&#x53EF;&#x4EE5;&#x5199;&#x6210;&#x533F;&#x540D;&#x5185;&#x90E8;&#x7C7B;&#x7684;&#x65B9;&#x5F0F;&#x4E5F;&#x53EF;&#x4EE5;&#x5199;&#x6210;&#x5168;&#x5C40;&#x65B9;&#x5F0F;&#xFF09;</li>
</ul>
</li>
</ul>
<figure class="highlight java"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br><span class="line">38</span><br><span class="line">39</span><br></pre></td><td class="code"><pre><span class="line">OnLoginStateListener mOnLoginListener = <span class="keyword">new</span> OnLoginStateListener() {</span><br><span class="line">     <span class="meta">@Override</span></span><br><span class="line">     <span class="function"><span class="keyword">public</span> <span class="keyword">void</span> <span class="title">onState</span><span class="params">(Activity activity, LoginResult result)</span> </span>{</span><br><span class="line">         <span class="keyword">switch</span> (result.state) {</span><br><span class="line">             <span class="keyword">case</span> LoginResult.STATE_SUCCESS:</span><br><span class="line">                 Log.e(TAG, result.getResultModel().toString());</span><br><span class="line">                 mTxtResult.setText(result.getResultModel().toString());</span><br><span class="line">                 <span class="keyword">break</span>;</span><br><span class="line"></span><br><span class="line">             <span class="keyword">case</span> LoginResult.STATE_FAIL:</span><br><span class="line">                 Log.e(TAG,result.getError().toString());</span><br><span class="line">                 Log.e(TAG, <span class="string">&quot;STATE_FAIL&quot;</span>);</span><br><span class="line">                 <span class="keyword">break</span>;</span><br><span class="line">             <span class="keyword">case</span> LoginResult.STATE_CANCEL:</span><br><span class="line">                 Log.e(TAG, <span class="string">&quot;STATE_FAIL&quot;</span>);</span><br><span class="line">                 <span class="keyword">break</span>;</span><br><span class="line">                  <span class="keyword">case</span> LoginResult.STATE_FAIL:</span><br><span class="line">                     <span class="keyword">if</span> (result.getError()!=<span class="keyword">null</span>){</span><br><span class="line">                         <span class="keyword">switch</span> (result.getError().getCode()){</span><br><span class="line">                             <span class="keyword">case</span> LTGameError.CODE_PARAM_ERROR:{</span><br><span class="line">                                 Log.e(<span class="string">&quot;RESULT123&quot;</span>, result.getError().getMsg());</span><br><span class="line">                                 <span class="keyword">break</span>;</span><br><span class="line">                             }</span><br><span class="line">                             <span class="keyword">case</span> LTGameError.CODE_REQUEST_ERROR:{</span><br><span class="line">                                 Log.e(<span class="string">&quot;RESULT123&quot;</span>, result.getError().getMsg());</span><br><span class="line">                                 <span class="keyword">break</span>;</span><br><span class="line">                             }</span><br><span class="line">                             <span class="keyword">case</span> LTGameError.CODE_NOT_SUPPORT:{</span><br><span class="line">                                 Log.e(<span class="string">&quot;RESULT123&quot;</span>, result.getError().getMsg());</span><br><span class="line">                                 <span class="keyword">break</span>;</span><br><span class="line">                             }</span><br><span class="line">                         }</span><br><span class="line">                     }</span><br><span class="line">                     <span class="keyword">break</span>;</span><br><span class="line"></span><br><span class="line">         }</span><br><span class="line">     }</span><br><span class="line"></span><br><span class="line"> };</span><br></pre></td></tr></table></figure>

<ul>
<li>3&#x3001;&#x767B;&#x5F55;&#x5F00;&#x59CB;</li>
</ul>
<pre><code>LoginObject object = new LoginObject();
           object.setBaseUrl(baseUrl);//&#x670D;&#x52A1;&#x5668;url
           object.setmAdID(mAdID);//&#x552F;&#x4E00;&#x5E7F;&#x544A;ID
           object.setLTAppID(LTAppID);&#x4E50;&#x63A8;AppID
           object.setLTAppKey(LTAppKey);//&#x4E50;&#x63A8;AppKey
           object.setQqAppID(mQQAppID);//qq&#x5E73;&#x53F0;&#x7533;&#x8BF7;&#x7684;AppID
           object.setLoginOut(false);//&#x662F;&#x5426;&#x9000;&#x51FA;&#xFF0C;true&#xFF1A;&#x662F;&#xFF0C;false&#xFF1A;&#x5426;
           LoginManager.login(QQActivity.this, Target.LOGIN_QQ, object, mOnLoginListener);</code></pre><ul>
<li><p>4&#x3001;&#x7ED3;&#x679C;&#x7801;&#xFF08;&#x5177;&#x4F53;&#x4EE5;&#x63A5;&#x53E3;&#x56DE;&#x8C03;&#x7ED3;&#x679C;&#x4E3A;&#x51C6;&#xFF09;</p>
<pre><code>//&#x5F00;&#x59CB;
STATE_START
//&#x6210;&#x529F;
STATE_SUCCESS 
//&#x5931;&#x8D25;
STATE_FAIL
//&#x53D6;&#x6D88;
STATE_CANCEL
//&#x5B8C;&#x6210;
STATE_COMPLETE 
//&#x6709;&#x6548;
STATE_ACTIVE </code></pre></li>
</ul>
<p><strong>&#x6CE8;&#x610F;&#xFF1A;LoginResult</strong> &#x9644;&#x5E26;&#x6709;&#x767B;&#x5F55;&#x7ED3;&#x679C; <strong>result.getResultModel().toString()</strong>&#x4E3A;&#x5177;&#x4F53;&#x4FE1;&#x606F;</p>

      
    </div>
    
    
    

    

    

    

    <footer class="post-footer">
      

      
      
      

      
        <div class="post-nav">
          <div class="post-nav-next post-nav-item">
            
              <a href="/2019/10/18/Android支付接入说明/" rel="next" title="支付接入说明">
                <i class="fa fa-chevron-left"></i> 支付接入说明
              </a>
            
          </div>

          <span class="post-nav-divider"></span>

          <div class="post-nav-prev post-nav-item">
            
              <a href="/2019/12/02/SDK支付接入说明（新版本）/" rel="prev" title="SDK支付接入说明（新版本）">
                SDK支付接入说明（新版本） <i class="fa fa-chevron-right"></i>
              </a>
            
          </div>
        </div>
      

      
      
    </footer>
  </div>
  
  
  
  </article>



    <div class="post-spread">
      
    </div>
  </div>


          </div>
          


          

  



        </div>
        
          
  
  <div class="sidebar-toggle">
    <div class="sidebar-toggle-line-wrap">
      <span class="sidebar-toggle-line sidebar-toggle-line-first"></span>
      <span class="sidebar-toggle-line sidebar-toggle-line-middle"></span>
      <span class="sidebar-toggle-line sidebar-toggle-line-last"></span>
    </div>
  </div>

  <aside id="sidebar" class="sidebar">
    
    <div class="sidebar-inner">

      

      
        <ul class="sidebar-nav motion-element">
          <li class="sidebar-nav-toc sidebar-nav-active" data-target="post-toc-wrap">
            文章目录
          </li>
          <li class="sidebar-nav-overview" data-target="site-overview-wrap">
            站点概览
          </li>
        </ul>
      

      <section class="site-overview-wrap sidebar-panel">
        <div class="site-overview">
          <div class="site-author motion-element" itemprop="author" itemscope itemtype="http://schema.org/Person">
            
              <p class="site-author-name" itemprop="name">Silence潇湘夜雨</p>
              <p class="site-description motion-element" itemprop="description">Android开发一枚</p>
          </div>

          <nav class="site-state motion-element">

            
              <div class="site-state-item site-state-posts">
              
                <a href="/archives/">
              
                  <span class="site-state-item-count">55</span>
                  <span class="site-state-item-name">日志</span>
                </a>
              </div>
            

            
              
              
              <div class="site-state-item site-state-categories">
                <a href="/categories/index.html">
                  <span class="site-state-item-count">16</span>
                  <span class="site-state-item-name">分类</span>
                </a>
              </div>
            

            

          </nav>

          

          
            <div class="links-of-author motion-element">
                
                  <span class="links-of-author-item">
                    <a href="https://github.com/muyishuangfeng" target="_blank" title="GitHub">
                      
                        <i class="fa fa-fw fa-github"></i>GitHub</a>
                  </span>
                
                  <span class="links-of-author-item">
                    <a href="https://www.jianshu.com/u/1e2eec6f972c" target="_blank" title="简书">
                      
                        <i class="fa fa-fw fa-heartbeat"></i>简书</a>
                  </span>
                
                  <span class="links-of-author-item">
                    <a href="https://juejin.im/user/58df0abf61ff4b006b115e43" target="_blank" title="掘金">
                      
                        <i class="fa fa-fw fa-star"></i>掘金</a>
                  </span>
                
                  <span class="links-of-author-item">
                    <a href="https://twitter.com/yangke20792452" target="_blank" title="Twitter">
                      
                        <i class="fa fa-fw fa-twitter"></i>Twitter</a>
                  </span>
                
            </div>
          

          
          

          
          

          

        </div>
      </section>

      
      <!--noindex-->
        <section class="post-toc-wrap motion-element sidebar-panel sidebar-panel-active">
          <div class="post-toc">

            
              
            

            
              <div class="post-toc-content"><ol class="nav"><li class="nav-item nav-level-3"><a class="nav-link" href="#google登录接入说明"><span class="nav-number">1.</span> <span class="nav-text">google登录接入说明</span></a><ol class="nav-child"><li class="nav-item nav-level-4"><a class="nav-link" href="#Facebook登录说明"><span class="nav-number">1.1.</span> <span class="nav-text">Facebook登录说明</span></a></li></ol></li><li class="nav-item nav-level-3"><a class="nav-link" href="#QQ-登录说明"><span class="nav-number">2.</span> <span class="nav-text">QQ 登录说明</span></a></li></ol></div>
            

          </div>
        </section>
      <!--/noindex-->
      

      
        <div class="back-to-top">
          <i class="fa fa-arrow-up"></i>
          
            <span id="scrollpercent"><span>0</span>%</span>
          
        </div>
      

    </div>
  </aside>


        
      </div>
    </main>

    <footer id="footer" class="footer">
      <div class="footer-inner">
        <div class="copyright">&copy; <span itemprop="copyrightYear">2020</span>
  <span class="with-love">
    <i class="fa fa-user"></i>
  </span>
  <span class="author" itemprop="copyrightHolder">Silence潇湘夜雨</span>

  
    <span class="post-meta-divider">|</span>
    <span class="post-meta-item-icon">
      <i class="fa fa-area-chart"></i>
    </span>
    
      <span class="post-meta-item-text">Site words total count&#58;</span>
    
    <span title="Site words total count">114.8k</span>
  
</div>


  <div class="powered-by">由 <a class="theme-link" target="_blank" href="https://hexo.io">Hexo</a> 强力驱动</div>



  <span class="post-meta-divider">|</span>



  <div class="theme-info">主题 &mdash; <a class="theme-link" target="_blank" href="https://github.com/iissnan/hexo-theme-next">NexT.Pisces</a> v5.1.4</div>




        







        
      </div>
    </footer>

    

    

  </div>

  

<script type="text/javascript">
  if (Object.prototype.toString.call(window.Promise) !== '[object Function]') {
    window.Promise = null;
  }
</script>









  












  
  
    <script type="text/javascript" src="/lib/jquery/index.js?v=2.1.3"></script>
  

  
  
    <script type="text/javascript" src="/lib/fastclick/lib/fastclick.min.js?v=1.0.6"></script>
  

  
  
    <script type="text/javascript" src="/lib/jquery_lazyload/jquery.lazyload.js?v=1.9.7"></script>
  

  
  
    <script type="text/javascript" src="/lib/velocity/velocity.min.js?v=1.2.1"></script>
  

  
  
    <script type="text/javascript" src="/lib/velocity/velocity.ui.min.js?v=1.2.1"></script>
  

  
  
    <script type="text/javascript" src="/lib/fancybox/source/jquery.fancybox.pack.js?v=2.1.5"></script>
  


  


  <script type="text/javascript" src="/js/src/utils.js?v=5.1.4"></script>

  <script type="text/javascript" src="/js/src/motion.js?v=5.1.4"></script>



  
  


  <script type="text/javascript" src="/js/src/affix.js?v=5.1.4"></script>

  <script type="text/javascript" src="/js/src/schemes/pisces.js?v=5.1.4"></script>



  
  <script type="text/javascript" src="/js/src/scrollspy.js?v=5.1.4"></script>
<script type="text/javascript" src="/js/src/post-details.js?v=5.1.4"></script>



  


  <script type="text/javascript" src="/js/src/bootstrap.js?v=5.1.4"></script>



  


  




	





  





  












  





  

  

  

  
  

  

  

  

  <!-- 页面点击小红心 -->
<script type="text/javascript" src="/js/src/love.js"></script>
<script src="/live2dw/lib/L2Dwidget.min.js?094cbace49a39548bed64abff5988b05"></script><script>L2Dwidget.init({"model":{"scale":1,"hHeadPos":0.5,"vHeadPos":0.618},"display":{"superSample":2,"width":150,"height":300,"position":"right","hOffset":0,"vOffset":-20},"mobile":{"show":false},"react":{"opacityDefault":0.5,"opacityOnHover":0.5},"log":false,"pluginJsPath":"lib/","pluginModelPath":"assets/","pluginRootPath":"live2dw/","tagMode":false});</script></body>
</html>
